package demo4.controller;


import com.tedu.InputUtil;
import demo4.mapper.IUserMapper;
import demo4.vo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class UserController {
    @Autowired
    private IUserMapper userMapper;
    public void regUser(){
        User user = InputUtil.getInputObject(new User(),"欢迎注册");
        if (userMapper.selectByUsername(user.getUsername())==null){
            userMapper.insert(user);
            System.out.println("恭喜您注册成功!");
        }else {
            System.out.println("该用户已存在");
        }
    }
}
